<%@ page language="Java" import="java.util.*,descriptor.*,cv.*" %>
    
    <%
    	int nbOffers = (Integer)request.getAttribute("nbOffers");
    	int nbPersoOffers = (Integer)request.getAttribute("nbPersoOffers");
    	TimetableListDescriptor tbList2 = (TimetableListDescriptor)request.getAttribute("tbList2");
    	if(nbOffers < 0)
    		nbOffers = 0;
    	if(nbPersoOffers < 0)
    		nbPersoOffers = 0;
    %>
    
    
		<div id="leftnav">
  			<ul id="sidebarright">
				<li onclick="showmenu(document.getElementById('smenu1'));" style="cursor: pointer;"><h2>Student</h2>
					<ul id="smenu1" style="display: none;">
						<li>
							<form name="link1" method="post">
								<input type="hidden" name="action" value="viewInfo">     
							</form> 
							<a href="javascript:document.link1.submit();" title="View general information">Informations</a>
						</li>
						<li>
							<form name="link2" method="post">
								<input type="hidden" name="action" value="settings">     
							</form> 
							<a href="javascript:document.link2.submit();" title="">Settings</a>
						</li>
					</ul>
		 		</li>
					<li onclick="showmenu(document.getElementById('smenu2'));" style="cursor: pointer;"><h2>CV</h2>	
						<ul id="smenu2" style="display: none;">
						<li>
							<form name="link3" method="post">
								<input type="hidden" name="action" value="viewCVs">     
							</form> 
							<a href="javascript:document.link3.submit();" title="View all CVs">List of all CVs uploded</a>
						</li>
						<li>
							<form name="link4" method="post">
								<input type="hidden" name="action" value="uploadCV">     
							</form> 
							<a href="javascript:document.link4.submit();" title="Upload a CV">Upload</a>
						</li>
					</ul>
 				</li>
				<li onclick="showmenu(document.getElementById('smenu3'));" style="cursor: pointer;"><h2>Supervisor</h2> 	
					<ul id="smenu3" style="display: none;">
						<li>
							<form name="link5" method="post">
								<input type="hidden" name="action" value="academicSup">     
							</form> 
							<a href="javascript:document.link5.submit();" title="Details about your Academic Suppervisor">Academic Supervisor</a>
						</li>		
						<li>
							<form name="link6" method="post">
								<input type="hidden" name="action" value="companySup">     
							</form> 
							<a href="javascript:document.link6.submit();" title="Details about your Company Suppervisor">Company Supervisor</a>
						</li>
					</ul>
				</li>
				<li onclick="showmenu(document.getElementById('smenu4'));" style="cursor: pointer;"><h2>Company</h2> 	
					<ul id="smenu4" style="display: none;">
						<li>
							<form name="link7" method="post">
								<input type="hidden" name="action" value="allCompanies">     
							</form> 
							<a href="javascript:document.link7.submit();" title="Diplay the all companies details">List of all Companies</a>
						</li>		
						<li>
							<form name="link8" method="post">
								<input type="hidden" name="action" value="setCompanies">     
							</form> 
							<a href="javascript:document.link8.submit();" title="Set up the preferences of companies">Preferences</a>
						</li>
						<li>
							<form name="link9" method="post">
								<input type="hidden" name="action" value="favouriteComp">     
							</form> 
							<a href="javascript:document.link9.submit();" title="Diplay favourite companies details">Favourite Companies</a>
						</li>
					</ul>
				</li>
				<li onclick="showmenu(document.getElementById('smenu5'));" style="cursor: pointer;"><h2>Query</h2> 	
					<ul id="smenu5" style="display: none;">
						<li>
							<form name="link10" method="post">
								<input type="hidden" name="action" value="allQueries">     
							</form> 
							<a href="javascript:document.link10.submit();" title="Diplay the status of sent queries">View all sent queries</a>
						</li>		
						<li>
							<form name="link11" method="post">
								<input type="hidden" name="action" value="sendQuery">     
							</form> 
							<a href="javascript:document.link11.submit();" title="Send a query to an Academic Supervisor">Send a query</a>
						</li>
					</ul>
				</li>
				<li onclick="showmenu(document.getElementById('smenu6'));" style="cursor: pointer;"><h2>Offer</h2> 	
	 				<ul id="smenu6" style="display: none;">
 						<li>
 							<form name="link12" method="post">
								<input type="hidden" name="action" value="offerBy">     
							</form> 
							<a href="javascript:document.link12.submit();" title="View all offers">General Offers (<%= nbOffers %>)</a>
 						<li>
 							<form name="link13" method="post">
								<input type="hidden" name="action" value="persoOffers">     
							</form> 
							<a href="javascript:document.link13.submit();" title="View specific offers">Personal & Applied Offers (<%= nbPersoOffers %>)</a>
 						</li>
					</ul>
				 </li>
			</ul>
   		</div>
   		<div id="rightnav">
  			<ul id="sidebarleft">
				<li onclick="showmenu(document.getElementById('smenu7'));" style="cursor: pointer;"><h2>Placement Diary</h2> 	
					<ul id="smenu7" style="display: none;">
						<li>
							<form name="link14" method="post">
								<input type="hidden" name="action" value="viewDiary">     
							</form> 
							<a href="javascript:document.link14.submit();" title="">View Diary</a>
						</li>		
						<li>
							<li>
							<form name="link15" method="post">
								<input type="hidden" name="action" value="editDiary">     
							</form> 
							<a href="javascript:document.link15.submit();" title="">Edit Diary</a>
						</li>
					</ul>
				</li>
				<li><h2 id="trigger">Timetable</h2> 	
	 				<ul>
 						<li>
 							<div id="calendar" style="margin: 0;">
 								<form name="dateSelected" method="post">
 									<input type="hidden" name="action" value="dateSelected">
									<input type="hidden" id="day" name="day" value=""> 
									<input type="hidden" id="month" name="month" value="">   
									<input type="hidden" id="year" name="year" value=""> 
								</form> 
 								</div>
	 							<script type="text/javascript">
	 								var interviewDayArray =[<% if(tbList2 != null)
															   	{
																	for(int i=0 ; i<tbList2.sizeTimetableList()-1 ; i++)
																	{ 
															%>
																<%= tbList2.getTimetableDescriptors().elementAt(i).getDay() %>,
															<%			
																	}
															%>		
																<%= tbList2.getTimetableDescriptors().elementAt(tbList2.sizeTimetableList()-1).getDay() %>
															<%	
																}
															%>
															]
									var interviewMonthArray = [<% if(tbList2 != null)
															   {
																	for(int i=0 ; i<tbList2.sizeTimetableList()-1 ; i++)
																	{ 
															%>
																<%= tbList2.getTimetableDescriptors().elementAt(i).getMonth() %>,
															<%			
																	}
															%>		
																<%= tbList2.getTimetableDescriptors().elementAt(tbList2.sizeTimetableList()-1).getMonth() %>
															<%	
																}
															%>
															]
									var interviewYearArray = [<% if(tbList2 != null)
															   {
																	for(int i=0 ; i<tbList2.sizeTimetableList()-1 ; i++)
																	{ 
															%>
																<%= tbList2.getTimetableDescriptors().elementAt(i).getYear() %>,
															<%			
																	}
															%>		
																<%= tbList2.getTimetableDescriptors().elementAt(tbList2.sizeTimetableList()-1).getYear() %>
															<%	
																}
															%>
															]
	     							function flatCalendarCallback(cal) 
	     							{
										if (cal.dateClicked) 
										{
											document.getElementById('day').value = cal.date.print("%e");
											document.getElementById('month').value = cal.date.print("%m");
											document.getElementById('year').value = cal.date.print("%Y");
											document.dateSelected.submit();
										}
									}
									
									function interview(dateValue)
	     							{
   										for(var i in interviewDayArray)
   										{
   											if(dateValue.getDate() == interviewDayArray[i])
   											{
   												if(dateValue.getMonth() == (interviewMonthArray[i]-1))
   												{
   													if(dateValue.getFullYear() == interviewYearArray[i])
   													{
   														return "special";
   													}
   												}
   											}
   										}
	     							}
	     							
	     							Zapatec.Calendar.setup(
	     							{
	        							firstDay          : 1,
	        							align 			  : "Bc",
	        							range             : [2008.01, 2999.12],
	        							electric          : false,
	       								flat 			  : "calendar",
	       								noCloseButton 	  : true,
	       								noHelp			  : true,
	       								weekNumbers       : false,
	       								inputField        : "dateSelected",
	       								dateStatusFunc 	  : interview,
	       								flatCallback 	  : flatCalendarCallback 
	      							}
	      							);
	   							</script>
 						</li>
 						<li>
	 						<form name="link16" method="post">
								<input type="hidden" name="action" value="allEvents">     
							</form> 
							<a href="javascript:document.link16.submit();" title="View all events">Events</a>
 						</li>
 						<li>
 							<form name="link17" method="post">
								<input type="hidden" name="action" value="addEvents">     
							</form> 
							<a href="javascript:document.link17.submit();" title="Add an event">Add an event</a>
 						</li>
					</ul>
				</li>
				<li><h2>Bulletin Board</h2> 	
				 </li>
			</ul>
		</div>